import type {PageParam, PageResult} from '@vben/request';
import type {Dayjs} from 'dayjs';

import {requestClient} from '#/api/request';
export namespace PerBusinessFamilyDepositApi {
  /** 国境外存款信息业务信息 */
  export interface BusinessFamilyDeposit {
    id: number; // 主键ID
    busiId?: string; // 业务主表id
    familyDepositId: number; // 正式表ID，对应 per_family_deposit.id
    employeeId?: number; // 人员ID，对应 per_employee.id
    relation: string; // 与本人关系（称谓）
    systemPersonId: number; // 系统人员ID，对应 system_person.id
    familyName: string; // 存款人姓名
    cardType: string; // 证件类型
    familyIdcard: string; // 存款人身份证号
    countryCity: string; // 存款的国家地区及城市
    bankName: string; // 开户银行或金融机构全称
    currency: string; // 存款币种
    amountRmb: number; // 人民币金额
    remark: string; // 备注
    status: number; // 状态（1：有效，0：无效）
    changeType: string; // 变更类型（add：新增，update：修改，delete：删除）
    changeContent: string; // 变更内容(JSON格式，记录变更前后对比，只有修改的时候记录)
    auditStatus: number; // 审核状态（0 草稿 1 审核中 2 审核完成）
    finalAuditStatus: number; // 最终审核状态：0 待审核 1 审核通过 2 审核不通过
    auditTime: string | Dayjs; // 审核完成时间
    auditor: string; // 审核人
    auditComment: string; // 审核意见
    metadata: string; // 其他参数
  }
}

/** 查询国境外存款信息业务分页 */
export function getBusinessFamilyDepositPage(data: PageParam,desensitize: boolean,encrypt: boolean) {
  return requestClient.post<PageResult<PerBusinessFamilyDepositApi.BusinessFamilyDeposit>>('/per/business-family-deposit/page', data,{ desensitize,encrypt });
}

/** 查询国境外存款信息业务详情 */
export function getBusinessFamilyDeposit(id: number) {
  return requestClient.get<PerBusinessFamilyDepositApi.BusinessFamilyDeposit>(`/per/business-family-deposit/get?id=${id}`);
}

/** 新增国境外存款信息业务 */
export function createBusinessFamilyDeposit(data: PerBusinessFamilyDepositApi.BusinessFamilyDeposit) {
  return requestClient.post('/per/business-family-deposit/create', data);
}

/** 修改国境外存款信息业务 */
export function updateBusinessFamilyDeposit(data: PerBusinessFamilyDepositApi.BusinessFamilyDeposit) {
  return requestClient.put('/per/business-family-deposit/update', data);
}

/** 删除国境外存款信息业务 */
export function deleteBusinessFamilyDeposit(id: number) {
  return requestClient.delete(`/per/business-family-deposit/delete?id=${id}`);
}

/** 批量删除国境外存款信息业务 */
export function deleteBusinessFamilyDepositList(ids: number[]) {
  return requestClient.delete(`/per/business-family-deposit/delete-list?ids=${ids.join(',')}`)
}

/** 导出国境外存款信息业务 */
export function exportBusinessFamilyDeposit(params: any) {
  return requestClient.download('/per/business-family-deposit/export-excel', { params });
}

/** 根据业务主表id去查询业务数据 */
export function getFamilyDepositBusiId(data: any) {
  return requestClient.post<PerBusinessFamilyDepositApi.BusinessFamilyDeposit>(
    `/per/business-family-deposit/getFamilyDepositBusiId`,
    data,
  );
}

/** 获取当前登录人国境外存款信息 */
export function getCurrentFamilyDeposit(
  data: any,
  desensitize: boolean,
  encrypt: boolean,
) {
  return requestClient.post<PerBusinessFamilyDepositApi.BusinessFamilyDeposit[]>(
    '/per/business-family-deposit/getCurrentFamilyDeposit',
    data,
    {
      desensitize,
      encrypt,
    },
  );
}
